package cn.ywang.current.demo;

import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;

/**
 * @author BeatificWang
 * @date 2019/7/30 22:50
 */
public class DataImportThread extends Thread {

	private String fileName;

	private CyclicBarrier cyclicBarrier;

	public DataImportThread(String fileName, CyclicBarrier cyclicBarrier) {
		this.fileName = fileName;
		this.cyclicBarrier = cyclicBarrier;
	}

	@Override
	public void run() {
		try {
			System.out.println("导入文件：" + this.fileName);
			this.cyclicBarrier.await();
		} catch (InterruptedException e) {
			e.printStackTrace();
		} catch (BrokenBarrierException e) {
			e.printStackTrace();
		}
	}
}
